<?php
	/**
	 * 安全检查类
	 * Enter description here ...
	 * @author cui
	 *
	 */
	class security extends base
	{
		private static $self;

		/**
		 * 构造函数
		 * Enter description here ...
		 */
		private function __construct()
		{

		}

		/**
		 * 单例入口
		 * Enter description here ...
		 */
		public static function get_self()
		{
			if (self::$self)
			{
				return self::$self;
			}

			self::$self = new self();

			return self::$self;
		}

		/**
		 * 开始建造
		 * Enter description here ...
		 */
		public function begin()
		{
			$this->process_post();
			$this->process_cookie();
		}

		/**
		 * 处理GET
		 * Enter description here ...
		 */
		public function process_get($info)
		{
			unset($_GET);

			$count = count($info);

	        for ($i = 0; $i < $count; $i += 2)
	        {
	            $_GET[$info[$i]] = addslashes($info[$i+1]);
	        }
		}

		/**
		 * 处理POST
		 * Enter description here ...
		 */
		private function process_post()
		{
			foreach ($_POST AS $k => $v)
			{
				$_POST[$k] = addslashes($v);
			}
		}

		/**
		 * 处理COOKIE
		 * Enter description here ...
		 */
		private function process_cookie()
		{
			foreach ($_COOKIE AS $k => $v)
			{
				$_COOKIE[$k] = addslashes($v);
			}
		}
	}